<?php
if (!defined('BASEPATH'))
    exit('No direct script access allowed');

class Server extends MY_Controller {
    public function __construct(){
        parent::__construct();
        $this->load->library('nusoap_lib');
        $this->disable_layout();
        $this->server = new soap_server();
        $this->server->configureWSDL('server','urn:server');
        $this->server->wsdl->addComplexType(array('userRecordSet','completeType','array','',"SOAP-ENC:Array",array(
                "user_id"=>array("name"=>"user_id", "type"=>"xsd:int"),
                "username"=>array("name"=>"username", "type"=>"xsd:string")
            )));
        $this->server->register(
            "selectMembers",
            array(
                "start" => "xsd:int",
                "limit" => "xsd:int"
            ),
            array("return"=>"tns:userRecordSet"),
            "urn:server",
            "urn:server#selectMembers",
            "rpc",
            "encoded",
            "Retrieves members' list"
        );
    }
    function index(){
        $this->disable_view();
    }
    function WS_selectMembers(){
        function selectMembers()
        {
            $this->disable_view();
            $this->load->model('tank_auth/users','users');
            $users = $this->users->get_user();
            return $users;
        }
         $this->server->service(file_get_contents("php://input"));
    }
}